#define _CRT_SECURE_NO_WARNINGS 1
#include<iostream>
#include<cstring>
#include<algorithm>	
#include<math.h>
#include<cstdio>
#include<cmath>
using namespace std;
const int N = 1010;
int arr[N];
int n, d;
int p[N];
bool st[N];
int find(int x)
{
	if (x != p[x]) {	
		p[x] = find(p[x]);
	}
	return p[x];
}
struct node
{
	int x, y;
}s[N];

int juli(node a, node b)
{
	return (a.x - b.x) * (a.x - b.x) + (b.y - a.y) * (b.y - a.y);
}
int main()
{
	scanf("%d%d", &n, &d);
	for (int i = 1; i <= n; i++) {
		int x, y;
		scanf("%d%d", &x, &y);
		s[i].x = x;
		s[i].y = y;
	}
	for (int i = 1; i <= n; i++) {
		p[i] = i;
	}
	char ch[10];
	while (~scanf("%s", ch)) {
		if (ch[0] == 'O') {
			int a;
			scanf("%d", &a);
			st[a] = 1;
			int px = find(a);
			for (int i = 1; i <= n; i++) {
				if (st[i]) {
					if (juli(s[a], s[i]) <= d * d) {
						int px1 = find(i);
						p[px1] = px;
					}
				}
			}
		}
		else if (ch[0] == 'S') {
			int a, b;
			scanf("%d%d", &a, &b);
			int pa = find(a);
			int pb = find(b);
			if (pa == pb && st[a] && st[b]) {
				cout << "SUCCESS" << endl;
			}
			else {
				cout << "FAIL" << endl;
			}
		}
	}
	return 0;
}